<template>
	<view class="mine">
		<!-- <you-tabs :tabsList="tabsList" :activeName="activeName" @tabClick="tabClick"></you-tabs> -->

		<view class="company-box" v-if="activeName == '1'">
			<view class="all-data" v-if="companyList.length==0">
				暂无数据~
			</view>
			<view class="company-item" v-else v-for="item,index in companyList" :key="index">
				<view class="company-name">{{item.companyName}}</view>
				<view class="company-link">
					<text>{{item.contact}}</text>
					<text>{{item.phoneNumber}}</text>
				</view>
			</view>

		</view>
		<view class="company-box" v-else>
			<view class="invoice-item" v-for="item,index in invoiceList" :key="index">
				<view class="invoice-base">
					<text style="color: #1a1a1a;margin-right: 40rpx;">电子发票</text>
					<text>2019-05-06 11:08:51</text>
					<text style="color: #325EF5;margin-left: auto;">申请中</text>
				</view>
				<view class="invoice-name">深圳市跨越新科技有限公司</view>
				<view class="invoice-detail">
					<view class="invoice-column">
						<text class="invoice-top">发票代码</text>
						<text class="invoice-num">0440131800311</text>
					</view>
					<view class="invoice-column">
						<text class="invoice-top">发票号码</text>
						<text class="invoice-num">55409854</text>
					</view>
					<view class="invoice-column">
						<view></view>
						<text class="invoice-price">￥29.0</text>
					</view>
				</view>
			</view>

			<you-bottom-btn :btnConfig="bottomBtnConfig" @formSubmit="formSubmit">
			</you-bottom-btn>
		</view>
	</view>
</template>

<script>
	import Mine from '@/api/mine.js'
	export default {
		data() {
			return {
				bottomBtnConfig: [{
					text: '提交申请',
					class: 'confirm',
					funcName: 'formSubmit'
				}],
				tabsList: [{
						label: "维保公司",
						name: '1'
					},
					{
						// label: "发票申请",
						// name: '2'
					},
				],
				activeName: '1',
				companyList: [],
				invoiceList: [1, 2],
			}
		},
		onLoad() {
			this.getCooperateWbList();
		},
		methods: {
			tabClick(e) {
				console.log(e);
				this.activeName = e;
			},
			formSubmit() {
				uni.navigateTo({
					url: '/subPages/mine/invoiceApply'
				})
			},
			getCooperateWbList() {
				Mine.getWbCooperateList().then(res => {
					this.companyList = res.rows;
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.mine {
		background: #F6F8FA;
		width: 100vw;
		height: 100vh;
		box-sizing: border-box;
	}

	.company-box {
		padding: 0 28rpx;

		.company-item {
			height: 164rpx;
			border-radius: 24rpx;
			background: #fff;
			margin-top: 20rpx;
			box-sizing: border-box;
			padding: 35rpx 30rpx;

			.company-name {
				font-weight: 500;
				font-size: 28rpx;
				color: $main-font-black;
			}

			.company-link {
				font-size: 24rpx;
				color: $main-font-auxiliary;
				margin-top: 20rpx;
			}
		}

		.invoice-item {
			padding: 20rpx 24rpx;
			border-radius: 12rpx;
			background: #fff;
			margin-top: 20rpx;

			.invoice-base {
				font-size: 24rpx;
				font-weight: 400;
				line-height: 1;
				margin-bottom: 20rpx;
				display: flex;
				align-items: center;
				color: $main-font-auxiliary;
			}

			.invoice-name {
				color: $main-font-black;
				font-size: 28rpx;
				font-weight: bold;
				margin-bottom: 20rpx;
			}

			.invoice-detail {
				display: flex;
				justify-content: space-between;
				font-size: 24rpx;

				.invoice-column {
					display: flex;
					flex-direction: column;
					color: $main-font-black;
				}

				.invoice-top {
					color: $main-font-auxiliary;
				}

				.invoice-num {
					margin-top: 10rpx;
				}

				.invoice-price {
					font-weight: bold;
					font-size: 28rpx;
					margin-top: auto;
				}
			}
		}

		.all-data {
			width: 100%;
			height: 30vh;
			display: flex;
			align-items: center;
			justify-content: center;
		}
	}
</style>